package config

import (
	"code.bydev.io/cht/customer/kyc_admin_service/internal/utils/urpc/private"
	"code.bydev.io/frameworks/byone/kafka"
	"code.bydev.io/frameworks/byone/zrpc"
	"git.bybit.com/svc/go/pkg/bdal"
)

var (
	_config *Config // 供应商配置
)

type Config struct {
	zrpc.RpcServerConf
	NothingKycAdminDB bdal.DefaultSqlxConfig
	NothingInverseDB  bdal.DefaultSqlxConfig
	RPC               *private.RPCConfig
	KycAdminProducer  kafka.ProducerConfig
	ProviderConfig    *ProviderConfig
	AWSS3Config       *AWSS3Config
}

func InitConfig(c *Config) {
	_config = c
}

func GetProviderConfig() *ProviderConfig {
	return _config.ProviderConfig
}

type ProviderConfig struct {
	Sumsub *SumsubConfig
	Jumio  *JumioConfig
	Onfido *OnfidoConfig
}

type SumsubConfig struct {
	Domain        string `json:"domain"`
	Token         string `json:"token"`
	Secret        string `json:"secret"`
	WebhookSecret string `json:"webhook_secret"`
}

type JumioConfig struct {
	Domain                     string `json:"domain"`
	WorkflowDomain             string `json:"workflow_domain"`
	Token                      string `json:"token"`
	Secret                     string `json:"secret"`
	CallBackWorkFlow           string `json:"callback_workflow"`
	CallBackDocument           string `json:"callback_document"`
	CallBackFaceAuth           string `json:"callback_faceauth"`
	SuccessURL                 string `json:"success_url"`
	ErrorURL                   string `json:"error_url"`
	DataCenter                 string `json:"data_center"`
	DocumentVerificationDomain string `json:"document_verification_domain"`
	RetrievalDomain            string `json:"retrieval_domain"`
	CoreDomain                 string `json:"core_domain"`
	HealthCheckDomain          string `json:"health_check_domain"`
}

type OnfidoConfig struct {
	Domain                             string `json:"domain"`
	APIVersion                         string `json:"api_version"`
	APIToken                           string `json:"api_token"`
	WebHookToken                       string `json:"webhook_token"`
	Level1WorkflowIDTwoSide            string `json:"level1_workflow_id_two_side"`
	Level1WorkflowIDOneSide            string `json:"level1_workflow_id_one_side"`
	Level1WorkflowIDWeb                string `json:"level1_workflow_id_web"`
	Level2WorkflowID                   string `json:"level2_workflow_id"`
	SecondaryLevel1WorkflowID          string `json:"secondary_level1_workflow_id"`           // Secondary Level 1 Workflow ID
	SecondaryLevel2WorkflowID          string `json:"secondary_level2_workflow_id"`           // Secondary Level 2 Workflow ID
	Level2DecoupleWorkflowID           string `json:"level2_decouple_workflow_id"`            // 解耦第一证明
	SupplementLevel2DecoupleWorkflowID string `json:"supplement_level2_decouple_workflow_id"` // 解耦补充证明
}

type AWSS3Config struct {
	Bucket          string `json:"bucket"`
	AccessKeyID     string `json:"access_key_id"`
	SecretAccessKey string `json:"secret_access_key"`
	SessionToken    string `json:"session_token"`
}

func GetAWSS3Config() *AWSS3Config {
	return _config.AWSS3Config
}
